from django.db import models

# Create your models here.
# 集体检测地点表
class check_place(models.Model):
    uuid = models.CharField(verbose_name="uuid", max_length=100, db_column="uuid")
    longitude = models.CharField(
        verbose_name="经度", max_length=100, db_column="longitude", default=""
    )
    latitude = models.CharField(
        verbose_name="维度", max_length=100, db_column="latitude", default=""
    )
    province = models.CharField(
        verbose_name="省", max_length=100, db_column="province", default=""
    )
    city = models.CharField(
        verbose_name="市", max_length=100, db_column="city", default=""
    )
    region = models.CharField(
        verbose_name="县区", max_length=100, db_column="region", default=""
    )
    street = models.CharField(
        verbose_name="街道", max_length=100, db_column="street", default=""
    )
    place_name = models.CharField(
        verbose_name="检测地点", max_length=100, db_column="place_name", default=""
    )
    admin_uuid = models.CharField(
        verbose_name="管理员uuid", max_length=100, db_column="admin_uuid", default=""
    )


# 集体检测任务表
class group_check_task(models.Model):
    uuid = models.CharField(verbose_name="uuid", max_length=100, db_column="uuid")
    time_start = models.CharField(
        verbose_name="开始时间", max_length=100, db_column="time_start", default=""
    )
    time_end = models.CharField(
        verbose_name="结束时间", max_length=100, db_column="time_end", default=""
    )
    duration = models.CharField(
        verbose_name="持续时间", max_length=100, db_column="duration", default=""
    )
    sum_num = models.IntegerField(verbose_name="可预约总量", db_column="sum_num", default=0)
    used_num = models.IntegerField(
        verbose_name="已预约数量", db_column="used_num", default=0
    )
    place_uuid = models.CharField(
        verbose_name="预约地点外键", max_length=100, db_column="place_uuid", default=""
    )
    limit_order_time = models.CharField(
        verbose_name="开始预约时间", max_length=100, db_column="limit_order_time", default=""
    )


# 用户预约表
class user_check_task(models.Model):
    uuid = models.CharField(verbose_name="uuid", max_length=100, db_column="uuid")
    group_check_uuid = models.CharField(
        verbose_name="预约的检测任务组",
        max_length=100,
        db_column="group_check_uuid",
        default="",
    )
    user_uuid = models.CharField(
        verbose_name="用户表外键", max_length=100, db_column="user_uuid", default=""
    )
    sign_in_time = models.CharField(
        verbose_name="预约时间", max_length=100, db_column="sign_in_time", default=""
    )
    order_time = models.CharField(
        verbose_name="限制用户下次预约时间", max_length=100, db_column="order_time", default=""
    )
    state = models.CharField(
        verbose_name="用户预约核酸检测状态0-预约成功，1-已检测，2-预约失效", max_length=1, db_column="state", default="0"
    )
